package com.ss.android.common.lib;

import android.content.Context;
import android.text.TextUtils;

import com.ss.android.common.applog.AppLog;

import org.json.JSONObject;

public final class MobClickCombiner {
    public interface IUmengAgent {
        void init(Context arg1);

        void onEvent(Context arg1, String arg2);

        void onEvent(Context arg1, String arg2, String arg3);

        void onPause(Context arg1);

        void onResume(Context arg1);

        void setCustomVersion(String arg1);

        void setCustomVersionCode(int arg1);

        void setUmengChannel(String arg1);
    }

    private static IUmengAgent a = null;

    public static void onEvent(Context context, String arg3, String arg4) {
        if (!TextUtils.isEmpty(arg3) && context != null) {
            AppLog.a(arg3, arg4);
            IUmengAgent umengAgent = a;
            if (umengAgent != null) {
                if (TextUtils.isEmpty(arg4)) {
                    umengAgent.onEvent(context, arg3);
                } else {
                    umengAgent.onEvent(context, arg3, arg4);
                }
            }
        }
    }

    public static void onEvent(Context arg9, String arg10, String arg11, long arg12, long arg14) {
        onEvent(arg9, "umeng", arg10, arg11, arg12, arg14, null);
    }

    public static void onEvent(Context arg9, String arg10, String arg11, long arg12, long arg14, JSONObject arg16) {
        onEvent(arg9, "umeng", arg10, arg11, arg12, arg14, arg16);
    }

    public static synchronized void init(Context arg2) {
        IUmengAgent v0_1 = a;
        if (v0_1 != null) {
            v0_1.init(arg2);
        }
    }

    public static void setUmengAgent(IUmengAgent arg0) {
        a = arg0;
    }

    public static void setUmengChannel(String channel) {
        IUmengAgent umengAgent = a;
        if (umengAgent != null) {
            umengAgent.setUmengChannel(channel);
        }
    }

    public static void setVersionInfo(String arg1, int arg2) {
        IUmengAgent v0 = a;
        if (v0 != null) {
            v0.setCustomVersion(arg1);
            v0.setCustomVersionCode(arg2);
        }
    }

    public static void onEvent(Context arg10, String arg11, String arg12, String arg13, long arg14, long arg16, JSONObject arg18) {
        if (!TextUtils.isEmpty(arg12)) {
            String v1 = TextUtils.isEmpty(arg11) ? "umeng" : arg11;
            if (arg10 == null) {
                return;
            }

            AppLog.onEvent(v1, arg12, arg13, arg14, arg16, arg18);
            if (!"umeng".equals(v1)) {
                return;
            }

            IUmengAgent v0 = a;
            if (v0 == null) {
                return;
            }

            if (!"umeng".equals(v1)) {
                return;
            }

            if (TextUtils.isEmpty(arg13)) {
                v0.onEvent(arg10, arg12);
            }else {
                v0.onEvent(arg10, arg12, arg13);
            }
        }
    }

    public static void onEvent(Context arg1, String arg2) {
        if (!TextUtils.isEmpty(((CharSequence) arg2))) {
            if (arg1 != null) {
                AppLog.onEvent(arg2);
            }

            IUmengAgent v0 = a;
            if (v0 == null) {
                return;
            }

            v0.onEvent(arg1, arg2);
        }
    }

    public static void onResume(Context arg1) {
        AppLog.onResume(arg1);
        IUmengAgent v0 = a;
        if (v0 != null) {
            v0.onResume(arg1);
        }
    }

    public static void onPause(Context arg1) {
        AppLog.onPause(arg1);
        IUmengAgent v0 = a;
        if (v0 != null) {
            v0.onPause(arg1);
        }
    }
}

